import request from '@/utils/request';

// 分页查询文章列表
export function articleList(data) {
  return request({
    url: '/article/list',
    method: 'post',
    data
  })
}

// 获取文章状态列表
export function statusList() {
  return request({
    url: '/article/status',
    method: 'get'
  })
}

// 根据文章ID删除文章
export function deleteArticle(articleId) {
  return request({
    url: `/article/delete/${articleId}`,
    method: 'delete'
  })
}

// 根据文章ID发布文章
export function publishArticle(articleId) {
  return request({
    url: `/article/publish/${articleId}`,
    method: 'put'
  })
}

// 根据文章ID查询文章详情
export function articleDetail(articleId) {
  return request({
    url: `/article/info/${articleId}`,
    method: 'get'
  })
}

// 编辑文章信息
export function updateArticle(data) {
  return request({
    url: '/article/update',
    method: 'put',
    data
  })
}

// 创建文章
export function createArticle(data) {
  return request({
    url: '/article/create',
    method: 'post',
    data
  })
}
